#!/usr/bin/env pytho
# -*- coding: utf-8 -*-

import requests
import json

url = "http://172.16.1.188:8080/api/manage_member/user/auth/login" # 接口地址

payload = {
'password': '111111q',
'username': 'ZhongdefeiliaoyanCYDW01',
'uuid': '',
'verifyCode': '',
}
r = requests.post(url, json=payload, verify=False)
# print(r.text)
print(r.status_code)
token = json.loads(r.text)["token"] #获取登录后的token

urlcy ="http://172.16.1.21/xl-dcs/api/manage_member/user/member_admin" #子公司添加

data={
	"isDelete": "false",
	"adminId": "",
	"username": "yantaishinongyeshengc",  #*用户名
	"password": "qqqqqq",			#密码
	"contractNo": "zhoujingxinshidaiZGSZ01", #* 合同编号
	"unitName": "烟台市农业生产资料科技有限公司",  #*成员单位名称
	"uniformSocialCreditCode": "91370600705801983J",      #*社会统一信用代码
	"memberType": "",
	"memberProperties": "",
	"region": "北京市,市辖区,海淀区",
	"address": "详细地址中关村善缘街信联资信服务有限公司公司",
	"startTime": "",			#签约时间
	"endTime": "",
	"memberPriceId": "",
	"name": "管理员姓名",
	"mobilePhone": "18612320144",		#*电话
	"email": "18612320144@163.com",
	"telePhone": "0101-1234567",
	"department": "信息技术部门",
	"job": "众德肥料（烟台）有限公司",
	"adminRemark": "众德肥料（烟台）有限公司信息技术部门管理员备注",
	"business": "",
	"userRemark": "众德肥料（烟台）有限公司信息技术部门成员备注",
	"operationUser": "",
	"debtClass": [],
	"actionClass": [],
	"lastLoginTime": "",
	"debtName": "",
	"actionName": "",
	"memberTypeName": "",
	"memberPropertiesName": ""
}
data1=json.dumps(data)

headers = {"Accept"	:"application/json, text/plain, */*",
"Accept-Encoding"	:"gzip, deflate",
"Accept-Language"	:"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Authorization"	: token,
"Connection"	:"keep-alive",
"Content-Length"	:"561",
"Content-Type"	:"application/json",
"Host"	:"172.16.1.21",
"Referer"	:"http://172.16.1.21/loginTo/homepage",
"User-Agent"	:"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36"}


r2 = requests.post(url=urlcy, data=data1, headers=headers)

print(r2.json())


